

        var itemFollowingMove = floating = null;
        var decrease = 2;
       
        $(document).ready(function(){
            $(document).ready(function(){
                $('main ul.nav li').click(function(){
                    $('main ul.nav li').removeClass('active');
                    $(this).addClass('active');
                })
            })
            for(var s = 0;s < $('.scrollItem').length;s++){
                var dataMoveDown = $('.scrollItem')[s].getAttribute('data-bottom-top').substring($('.scrollItem')[s].getAttribute('data-bottom-top').indexOf("(") - 1,$('.scrollItem')[s].getAttribute('data-bottom-top').length - 1).split(',');
                var dataMoveTop = $('.scrollItem')[s].getAttribute('data-top-bottom').substring($('.scrollItem')[s].getAttribute('data-top-bottom').indexOf("(") - 1,$('.scrollItem')[s].getAttribute('data-top-bottom').length - 1).split(',');
                $('.scrollItem')[s].moveDown = parseInt(dataMoveDown[1]);
                $('.scrollItem')[s].moveTop = parseInt(dataMoveTop[1]);
                var itemTop = $('.scrollItem')[s].getBoundingClientRect().top;
                    
                    if(itemTop >= window.innerHeight){
                        console.log('chu');
                        $('.scrollItem')[s].currentMoveVal = $('.scrollItem')[s].moveDown;
                        $('.scrollItem')[s].style.transform = 'translate(0,' + $('.scrollItem')[s].currentMoveVal + 'px)';
                    }else if(itemTop < window.innerHeight && itemTop > -$('.scrollItem')[s].offsetHeight){
                        if($('.scrollItem')[s].className.indexOf('contrary') >= 0){
                            $('.scrollItem')[s].currentMoveVal = $('.scrollItem')[s].moveDown + ($('.scrollItem')[s].moveTop - $('.scrollItem')[s].moveDown) * ((window.innerHeight - itemTop) / (window.innerHeight + $('.scrollItem')[s].offsetHeight));
                        }else{
                            
                            $('.scrollItem')[s].currentMoveVal = $('.scrollItem')[s].moveDown - ($('.scrollItem')[s].moveDown - $('.scrollItem')[s].moveTop) * ((window.innerHeight - itemTop) / (window.innerHeight + $('.scrollItem')[s].offsetHeight));
                            $('.scrollItem')[s].decrease = window.innerWidth <= 767?1:(decrease * ((window.innerHeight - itemTop) / (window.innerHeight + $('.scrollItem')[s].offsetHeight)));
                            $('.scrollItem')[s].decrease > 1 && ($('.scrollItem')[s].decrease = 1);
                        }
                       
                       $('.scrollItem')[s].style.transform = 'translate(0,' + $('.scrollItem')[s].currentMoveVal + 'px) ' + 'scale(' + $('.scrollItem')[s].decrease + ")";
                    }else{
                        $('.scrollItem')[s].currentMoveVal = $('.scrollItem')[s].moveTop;
                        $('.scrollItem')[s].style.transform = 'translate(0,' + $('.scrollItem')[s].currentMoveVal + 'px)' + 'scale(' + 1 + ")";
                    }
                    
                    $('.scrollItem')[s].updating = false;
            }
            $(window).scroll(function(){   //开始监听滚动条
                    clearInterval(itemFollowingMove);
                    
                    itemFollowingMove = setInterval(function(){
                        
                        for(var f = 0;f < $('.scrollItem').length;f++){
                            //元素距离窗口顶部高度
                            var itemTop = $('.scrollItem')[f].getBoundingClientRect().top - $('.scrollItem')[f].currentMoveVal;
                            var destination;
                            
                            if(itemTop >= window.innerHeight){
                                destination = $('.scrollItem')[f].moveDown;
                                
                            }else if(itemTop < window.innerHeight && itemTop > -$('.scrollItem')[f].offsetHeight){
                                
                                if($('.scrollItem')[f].className.indexOf('contrary') >= 0){
                                    destination = $('.scrollItem')[f].moveDown + ($('.scrollItem')[f].moveTop - $('.scrollItem')[f].moveDown) * ((window.innerHeight - itemTop) / (window.innerHeight + $('.scrollItem')[f].offsetHeight));
                                }else{
                                    destination = $('.scrollItem')[f].moveDown - ($('.scrollItem')[f].moveDown - $('.scrollItem')[f].moveTop) * ((window.innerHeight - itemTop) / (window.innerHeight + $('.scrollItem')[f].offsetHeight));
                                    $('.scrollItem')[f].decrease = decrease * ((window.innerHeight - itemTop) / (window.innerHeight + $('.scrollItem')[f].offsetHeight));
                                    $('.scrollItem')[f].decrease > 1 && ($('.scrollItem')[f].decrease = 1);
                                }
                            }else{
                                
                                $('.scrollItem')[f].decrease = 1;
                                destination = $('.scrollItem')[f].moveTop;
                            }
                            /*if($('.scrollItem')[f].currentMoveVal == destination){
                                continue;
                            }*/
                            $('.scrollItem')[f].updating = true;
                            //举例; start:189 > destination 188.5 => 188,再次通过新的判断变为189,下次进入又会变为188 以此类推无限反复循环
                            if($('.scrollItem')[f].currentMoveVal < destination){
                                if(destination - $('.scrollItem')[f].currentMoveVal <= 1){
                                    $('.scrollItem')[f].currentMoveVal = destination;
                                }else{
                                    $('.scrollItem')[f].currentMoveVal = $('.scrollItem')[f].currentMoveVal + Math.ceil((destination - $('.scrollItem')[f].currentMoveVal) / 10);
                                }
                            }else{
                                if($('.scrollItem')[f].currentMoveVal - destination <= 1){
                                    $('.scrollItem')[f].currentMoveVal = destination;
                                }else{
                                    $('.scrollItem')[f].currentMoveVal = $('.scrollItem')[f].currentMoveVal - Math.ceil(($('.scrollItem')[f].currentMoveVal - destination) / 10);
                                }
                            }
                            window.innerWidth <= 767 && ($('.scrollItem')[f].decrease = 1);
                            $('.scrollItem')[f].style.transform = 'translate(0,' + $('.scrollItem')[f].currentMoveVal + 'px) ' + 'scale(' + $('.scrollItem')[f].decrease + ")";
                            if($('.scrollItem')[f].currentMoveVal == destination){
                                $('.scrollItem')[f].updating = false;
                            }
                        }
                        for(var j = 0;j < $('.scrollItem').length;j++){
                            if($('.scrollItem')[j].updating) return false;
                        }
                        
                        clearInterval(itemFollowingMove);
                        itemFollowingMove = null;
                    },10)
            })
            /*floating = setInterval(function(){
                if(window.innerWidth <= 767){
                    if($('.landscape .current')[0].className.indexOf('floating') < 0) return false;
                    $('.landscape .current').removeClass('floating');
                }
                if(itemFollowingMove == null){
                    if($('.landscape .current')[0].className.indexOf('floating') >= 0) return false;
                    $('.landscape .current').addClass('floating');
                }else{
                    if($('.landscape .current')[0].className.indexOf('floating') < 0) return false;
                    $('.landscape .current').removeClass('floating');
                }
            },10)*/
        })